*
* Descriptive statistics Outcomes
*
clear all

use epf2016.dta
*

* One household reports zero expenditure, we count this family in computing the mean expenditures and income and 
* do not take it into account in computing the mean budget shares
forvalues group=1/12 {
	replace gasto`group'=0 if gasto`group'==.
}
drop gastomon*
gen income=IMPEXAC*12
gen gastot=gasto1+gasto2+gasto3+gasto4+gasto5+gasto6+gasto7+gasto8+gasto9+gasto10+gasto11+gasto12
sum gasto1-gasto12 gastot income [aweight=FACTOR]
forvalues group=1/12 {
	gen gastoaeq`group'=gasto`group'/UC2
	gen share`group'=gasto`group'/gastot if GASTOT!=.
	replace share`group'=. if GASTOT==.
}
gen gastotaeq=gastot/UC2
gen incomeaeq=income/UC2
order gastoaeq* share*, sequential
sum gastoaeq1-gastoaeq12 gastotaeq incomeaeq [aweight=FACTOR]
sum share1-share12 [aweight=FACTOR]
forvalues group=1/12 {
	count if gasto`group'==0 
	dis r(N)/22011
}
count if gastot==0
dis r(N)/22011
count if income==0
dis r(N)/22011
*
* Rotating subsample
clear all
use epfipc2006-2019.dta
order gasto*, sequential
gen income=IMPEXAC*12
gen gastot=gasto1+gasto2+gasto3+gasto4+gasto5+gasto6+gasto7+gasto8+gasto9+gasto10+gasto11+gasto12
sum gasto1-gasto12 gastot income [aweight=FACTOR] if ANOENC==2016 & CLAVE==2 & GASTOT!=0
forvalues group=1/12 {
	gen gastoaeq`group'=gasto`group'/UC2
	gen share`group'=gasto`group'/GASTOT if GASTOT!=.
	replace share`group'=. if GASTOT==.
}
gen gastotaeq=gastot/UC2
gen incomeaeq=income/UC2
order gastoaeq* share*, sequential
sum gastoaeq1-gastoaeq12 gastotaeq incomeaeq [aweight=FACTOR] if ANOENC==2016 & CLAVE==2 & GASTOT!=0
sum share1-share12 [aweight=FACTOR] if ANOENC==2016 & CLAVE==2
forvalues group=1/12 {
	count if gasto`group'==0 & ANOENC==2016 & CLAVE==2
	dis r(N)/9287 
}
count if gastot==0 & ANOENC==2016 & CLAVE==2
dis r(N)/9287
count if income==0 & ANOENC==2016 & CLAVE==2 & gastot!=0
dis r(N)/9287
*
* The End
*
